package com.cloudlead.common.lang.api;

import java.util.Map;

import com.cloudlead.common.lang.annotation.Label;
import com.fasterxml.jackson.annotation.JsonIgnore;

public abstract class AbstractActionRequest implements ActionRequest {

	/**
	 * 
	 */
	private static final long serialVersionUID = -6341567480068160323L;
	@Label("请求编号")
	protected String requestId;

	@Label("请求超时")
	protected long timeout;

	@Label("是否取消")
	protected Boolean cancel;

	@Label("令牌")
	protected String accessToken;

	@JsonIgnore
	protected Map<String, String> requestHeaders;

	@Override
	public String getRequestId() {
		return requestId;
	}

	@Override
	public void setRequestId(String requestId) {
		this.requestId = requestId;
	}

	@Override
	public long getTimeout() {
		return timeout;
	}

	@Override
	public void setTimeout(long timeout) {
		this.timeout = timeout;
	}

	public boolean isCancel() {
		return null == cancel ? false : cancel;
	}

	public void setCancel(boolean cancel) {
		this.cancel = cancel;
	}

	public String getAccessToken() {
		return accessToken;
	}

	public void setAccessToken(String accessToken) {
		this.accessToken = accessToken;
	}

	public Map<String, String> getRequestHeaders() {
		return requestHeaders;
	}

	public void setRequestHeaders(Map<String, String> requestHeaders) {
		this.requestHeaders = requestHeaders;
	}

	@Override
	public String toString() {
		return "AbstractActionRequest [requestId=" + requestId + ", timeout="
				+ timeout + ", cancel=" + cancel + ", accessToken="
				+ accessToken + "]";
	}

}
